<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class InsertRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
     public function rules()
    {
        return [
            'tid' => 'required',
            'name' => 'required',
            'price' => 'required',
            'pic' => 'required',
            'desc' => 'required'
            ];
    }

    public function messages() {
        return [
            'tid.required' => 'ID不能为空',
            'name.required' => '商品名称不能为空',
            'price.required' => '商品价格不能为空',
            'pic.required' => '商品图片不能为空',
            'desc.required' => '商品描述不能为空'
            ];
    }
}
